﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package net.wooga.pets.controllers.contracts {
    import net.wooga.pets.models.world.vos.*;
    import net.wooga.pets.models.*;
    import net.wooga.pets.interfaces.*;
    import net.wooga.pets.constants.*;
    import org.robotlegs.mvcs.*;
    import net.wooga.pets.models.world.*;

    public class InitContractCommand extends Command {

		[Inject]
        public var world:WorldModel;
		[Inject]
        public var contractsModel:ContractsModel;

        override public function execute():void{
            var _local1:String = this.world.getRoomIdsOfType(GameConstants.TYPE_DOCK)[0];
            var _local2:IArea = (this.world.getRoomById(_local1) as IArea);
            if (_local2){
                if (_local2.contract){
                    this.contractsModel.currentContract = (_local2.contract as ContractVO);
                    this.contractsModel.state = ContractsModel.WAITING;
                } else {
                    this.contractsModel.state = ContractsModel.READY_TO_CREATE;
                };
            };
        }

    }
}//package net.wooga.pets.controllers.contracts 
